/**
 * History List Caretaker
 * va contenir des commande et states
 * Make singleton ????
 */

package Modele;

import java.util.ArrayList;
import java.util.List;

public class Caretaker {
	List<State> savedStates = new ArrayList<State>();
        private boolean isEmpty=true;

        private int current_pos=-1;

    public int getCurrent_pos() {
        return current_pos+1;
    }

        public Caretaker() {
            
        }

	public void addMemento(State m) {
		savedStates.add(m);
                
                current_pos++;
	}

	public State getMemento(int index) {
		return savedStates.get(index);
	}

        public State getLastState(){
            //Check for empty list...
            current_pos--;
            return savedStates.get(current_pos+1);
        }

        public State getNextState(){
            if (current_pos>savedStates.size()-2)
                return null;
            ++current_pos;
            return savedStates.get(current_pos+1);
        }

}